﻿using System;
using DotNetCore.CAP;
using K9Nano.Events;
using K9Nano.Events.Cap;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class CapStartupExtensions
    {
        public static CapBuilder AddCapEventBus(this IServiceCollection services, Action<CapOptions> setupAction)
        {
            services.Replace(ServiceDescriptor.Singleton<IEventBus, CapEventBus>());

            return services.AddCap(setupAction);
        }
    }
}
